#include "res.h"
#include "chess_board.h"
#include "game.h"


Res* g_Res = nullptr;

dl::gcText Res::GetTextBoardCenter()
{
	gcText ret;
	ret = g_factory->CreateText(1, 60, 棋盘字体颜色, 1, 棋盘字体颜色描边);
	return ret;
}

dl::gcText Res::GetTextMan(bool is_red)
{
	gcText ret;
	ret = g_factory->CreateText(1, 50, is_red ? 红棋颜色 : 黑棋颜色);
	return ret;
}

UI::ButtonSprite* Res::GetButtonWood()
{
	UI::ButtonSprite* ret = UI::ButtonSprite::Create(g_factory->CreateSpriteMulti("button"));
	ret->AddText(g_factory->CreateText(2, 16, ColorDef::WHITE, 1, ColorDef::BLACK), {
		ColorDef::WHITE,
		ColorDef::WHITE,
		ColorDef::GRAY
		}, { {0,-6},{0,-6},{0,-6 + 2} });
	ret->GetCoor()->SetScale(2.0f);
	return ret;
}

UI::EditBox* Res::GetEditBox()
{
	UI::Panel* panel = g_ui->CreatePanel();
	{
		UI::Background* bg = UI::Background::Create();
		bg->Set(Sprite9::Create("editbox_bg"));
		bg->SetSize({ 400,200 });
		panel->Add(bg);
	}

	UI::EditBox* ret = UI::EditBox::Create(panel, g_factory->CreateText(0, 25));
	ret->SetSingleLine(false);
	ret->SetColor({ ColorDef::BLACK });
	return ret;
}
